Skip to content

Conversation

@DDShantanuBadmanji
Copy link

@DDShantanuBadmanji DDShantanuBadmanji commented Oct 1, 2025

Delete this text and replace it with a detailed description of your change. The
PR title and body will become the squashed commit message.

If you would like to tag individuals, add some commentary, upload images, or
include other supplemental information that should not be part of the eventual
commit message, please use a separate comment.

If applicable, please include a summary of the testing strategy (including
rationale) for the proposed change. Unit and/or integration tests are expected
for any behavior change and system tests should be considered for larger
changes.

Summary by CodeRabbit

  • New Features

    • Config providers that support monitoring now automatically register metrics with standard tags (config, class, provider), improving observability in clients and Kafka Connect.
  • Documentation

    • Clarified how config providers can expose metrics and which tags are added.
  • Refactor

    • Switched internal handling of config providers to a plugin-based model across components without changing user-facing behavior.
  • Tests

    • Added tests validating monitorable config provider metrics and config transformation behavior.
  • Style

    • Minor formatting update to development configuration file (no functional impact).

@coderabbitai
Copy link

coderabbitai bot commented Oct 1, 2025

Walkthrough

The change replaces direct ConfigProvider usage with Plugin-wrapped providers across configuration resolution paths in clients and Connect. Constructors, fields, and cleanup paths now operate on Map<String, Plugin>. Tests are updated accordingly, a monitorable test provider is added, and minor formatting and Javadoc updates are included.

Changes

Cohort / File(s) Summary
Formatting
Vagrantfile
Added a blank line and a comment; no behavioral changes.
Core config pluginization
clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java, clients/src/main/java/org/apache/kafka/common/config/ConfigTransformer.java
Switched from Map<String, ConfigProvider> to Map<String, Plugin>; updated instantiation, transformation, and cleanup to use Plugin-wrapped providers.
ConfigProvider docs
clients/src/main/java/org/apache/kafka/common/config/provider/ConfigProvider.java
Javadoc notes that implementations may implement Monitorable; documents automatic metric tags. No API/behavior change.
Client tests update
clients/src/test/java/org/apache/kafka/common/config/ConfigTransformerTest.java, clients/src/test/java/org/apache/kafka/common/config/provider/MonitorableConfigProvider.java
Tests now wrap providers via Plugin.wrapInstance and use Map.of(...). Added a simple MonitorableConfigProvider test implementation.
Connect runtime pluginization
connect/mirror/src/main/java/org/apache/kafka/connect/mirror/MirrorMakerConfig.java, connect/runtime/src/main/java/org/apache/kafka/connect/runtime/Worker.java, connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerConfigTransformer.java, connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/Plugins.java
Internal provider handling changed to Plugin; Plugins.newConfigProvider now returns Plugin and accepts Metrics; updated construction, usage, and cleanup; adjusted arguments for provider creation.
Connect tests update
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerConfigTransformerTest.java, connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerTest.java, connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/PluginsTest.java
Tests adapted to plugin-wrapped providers; added metrics assertions for monitorable providers; introduced CustomMonitorableConfigProvider for testing plugin metrics integration.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Caller as Config user (Worker/MirrorMaker/AbstractConfig)
  participant Plugins as Plugins.newConfigProvider
  participant Plugin as Plugin<ConfigProvider>
  participant Transformer as ConfigTransformer
  participant Prov as ConfigProvider
  participant Metrics as PluginMetrics

  Caller->>Plugins: newConfigProvider(name, classLoaderUsage, metrics)
  Plugins->>Prov: instantiate & configure (prefix derived)
  Plugins->>Metrics: register provider metrics (if Monitorable)
  Plugins->>Plugin: wrapInstance(provider, metrics, prefix)
  Plugins-->>Caller: Plugin<ConfigProvider>

  Caller->>Transformer: new(..., Map<name, Plugin>)
  Note over Transformer: Store providerPlugins

  Caller->>Transformer: transform(props)
  Transformer->>Plugin: get provider by name
  alt provider exists
    Plugin->>Prov: get()
    Prov-->>Transformer: get(path, keys) -> ConfigData
    Transformer-->>Caller: transformed props + ttl
  else provider missing
    Transformer-->>Caller: unchanged props
  end

  Caller->>Plugin: close()
  Note right of Plugin: Closed via Utils.closeQuietly with plugin-specific message
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

I nibbled wires, neat and keen,
Wrapped each provider in a plugin sheen.
Metrics twinkled, tags in tow,
Through configs’ burrows, values flow.
Tests now hop with tidy grace—
Close the plugins, clear the space.
Carrot-merge complete. Let’s race! 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description remains the unedited placeholder text from the repository template and does not include any summary of changes, rationale, or testing strategy, so it fails to inform reviewers about what this PR does or why. Replace the placeholder with a detailed description of the changes made, including a summary of modifications across files, the reason for adopting Plugin<ConfigProvider>, and an outline of the testing strategy (unit or integration tests) used to validate the new behavior.
Docstring Coverage ⚠️ Warning Docstring coverage is 8.89% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title “Clone kafka 18894” is a generic reference to an issue or task identifier and does not succinctly describe the core changes in this pull request, making it unclear to reviewers what functionality or code area was modified. Please update the title to a concise, descriptive sentence that reflects the primary change—such as “Switch ConfigProvider usage to Plugin<ConfigProvider> wrapper throughout codebase”—so reviewers immediately understand the PR’s focus.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch clone-KAFKA-18894

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.39.5)
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerTest.java

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@refacto-visz
Copy link

refacto-visz bot commented Oct 1, 2025

⚠️ No Active Seat

The user @DDShantanuBadmanji does not have an active seat allocated for code reviews.

Please contact your organization admin to assign a seat or upgrade your subscription.

@gemini-code-assist
Copy link

Summary of Changes

Hello @DDShantanuBadmanji, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant enhancement to how ConfigProvider instances are managed and monitored within Kafka. The primary goal is to enable better observability by allowing ConfigProvider implementations to expose metrics through a new Plugin wrapper. This involves updates to core configuration and runtime components to ensure that ConfigProvider instances are consistently wrapped and their metrics are properly registered and tagged. The changes also include new test cases to validate this enhanced monitoring functionality.

Highlights

  • ConfigProvider Monitoring: ConfigProvider implementations can now implement the Monitorable interface to expose metrics, with automatic tagging for context, enhancing observability into their operation.
  • Plugin Wrapper for ConfigProviders: ConfigProvider instances are now consistently wrapped in a new Plugin object, centralizing their lifecycle management and enabling features like metrics registration.
  • Refactored Instantiation and Lifecycle: The instantiation and management of ConfigProvider instances have been refactored across several core components (e.g., AbstractConfig, ConfigTransformer, Worker) to integrate the Plugin wrapper, ensuring proper lifecycle management and metrics collection.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces metrics support for ConfigProvider implementations. The core change is wrapping ConfigProvider instances in a Plugin<T> object, which handles metrics registration for providers that implement the Monitorable interface.

The changes are well-executed and consistently applied throughout the codebase:

  • The Plugins.newConfigProvider method has been refactored to return a Plugin<ConfigProvider> and to correctly wire up metrics when available.
  • All call sites and consumers of ConfigProvider have been updated to work with the new Plugin wrapper, including AbstractConfig, ConfigTransformer, Worker, and MirrorMakerConfig.
  • The lifecycle of the ConfigProvider and its associated metrics is correctly managed through the Plugin wrapper's AutoCloseable implementation.
  • Unit tests have been updated to reflect these changes, and new tests have been added to verify the metrics functionality and the plugin lifecycle, which is great.
  • The use of Map.of in tests is a nice modernization touch.

Overall, this is a solid contribution that enhances the observability of config providers. The code is clean, and the changes are logical and well-tested. I have no further suggestions for improvement. Great work!

@refacto-visz
Copy link

refacto-visz bot commented Oct 1, 2025

⚠️ No Active Seat

The user @DDShantanuBadmanji does not have an active seat allocated for code reviews.

Please contact your organization admin to assign a seat or upgrade your subscription.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed79212 and 5989a26.

📒 Files selected for processing (13)
  • Vagrantfile (1 hunks)
  • clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java (4 hunks)
  • clients/src/main/java/org/apache/kafka/common/config/ConfigTransformer.java (3 hunks)
  • clients/src/main/java/org/apache/kafka/common/config/provider/ConfigProvider.java (1 hunks)
  • clients/src/test/java/org/apache/kafka/common/config/ConfigTransformerTest.java (5 hunks)
  • clients/src/test/java/org/apache/kafka/common/config/provider/MonitorableConfigProvider.java (1 hunks)
  • connect/mirror/src/main/java/org/apache/kafka/connect/mirror/MirrorMakerConfig.java (2 hunks)
  • connect/runtime/src/main/java/org/apache/kafka/connect/runtime/Worker.java (1 hunks)
  • connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerConfigTransformer.java (3 hunks)
  • connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/Plugins.java (3 hunks)
  • connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerConfigTransformerTest.java (5 hunks)
  • connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerTest.java (5 hunks)
  • connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/PluginsTest.java (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (10)
clients/src/test/java/org/apache/kafka/common/config/provider/MonitorableConfigProvider.java (1)
core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala (1)
  • withPluginMetrics (6299-6301)
clients/src/test/java/org/apache/kafka/common/config/ConfigTransformerTest.java (1)
clients/src/main/java/org/apache/kafka/common/internals/Plugin.java (1)
  • Plugin (33-92)
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerConfigTransformerTest.java (1)
clients/src/main/java/org/apache/kafka/common/internals/Plugin.java (1)
  • Plugin (33-92)
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerConfigTransformer.java (2)
clients/src/main/java/org/apache/kafka/common/internals/Plugin.java (1)
  • Plugin (33-92)
clients/src/main/java/org/apache/kafka/common/utils/Utils.java (1)
  • Utils (93-1700)
clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java (1)
clients/src/main/java/org/apache/kafka/common/internals/Plugin.java (1)
  • Plugin (33-92)
clients/src/main/java/org/apache/kafka/common/config/ConfigTransformer.java (1)
clients/src/main/java/org/apache/kafka/common/internals/Plugin.java (1)
  • Plugin (33-92)
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/PluginsTest.java (2)
clients/src/test/java/org/apache/kafka/common/config/provider/MonitorableConfigProvider.java (1)
  • MonitorableConfigProvider (29-58)
clients/src/main/java/org/apache/kafka/common/internals/Plugin.java (1)
  • Plugin (33-92)
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/Plugins.java (2)
clients/src/main/java/org/apache/kafka/common/internals/Plugin.java (1)
  • Plugin (33-92)
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerConfig.java (1)
  • WorkerConfig (58-463)
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerTest.java (3)
clients/src/test/java/org/apache/kafka/common/config/provider/MonitorableConfigProvider.java (1)
  • MonitorableConfigProvider (29-58)
clients/src/main/java/org/apache/kafka/common/internals/Plugin.java (1)
  • Plugin (33-92)
clients/src/main/java/org/apache/kafka/common/metrics/Metrics.java (1)
  • Metrics (70-696)
connect/mirror/src/main/java/org/apache/kafka/connect/mirror/MirrorMakerConfig.java (2)
clients/src/main/java/org/apache/kafka/common/internals/Plugin.java (1)
  • Plugin (33-92)
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/Plugins.java (1)
  • Plugins (59-696)
🔇 Additional comments (24)
clients/src/main/java/org/apache/kafka/common/config/provider/ConfigProvider.java (1)

32-35: LGTM! Clear documentation of the Monitorable integration.

The Javadoc update accurately documents the new capability for ConfigProvider implementations to register metrics via the Monitorable interface, and clearly lists the automatic tags that will be added.

clients/src/test/java/org/apache/kafka/common/config/ConfigTransformerTest.java (3)

20-20: LGTM! Import added for Plugin wrapper.

The new import supports the plugin-wrapped ConfigProvider pattern introduced in this PR.


49-49: LGTM! Test setup updated to use Plugin-wrapped provider.

The test now correctly wraps the TestConfigProvider with Plugin.wrapInstance, aligning with the broader PR changes that adopt plugin-based ConfigProvider management across the codebase.


54-105: LGTM! Test inputs modernized to use Map.of.

The tests have been updated to use Map.of(...) instead of Collections.singletonMap(...) for constructing input maps. This is a clean modernization that improves readability while maintaining the same test behavior.

connect/runtime/src/main/java/org/apache/kafka/connect/runtime/Worker.java (1)

212-222: LGTM! Provider initialization updated to plugin-based pattern.

The changes correctly update the provider initialization flow to use Plugin<ConfigProvider>:

  • The provider map type is now Map<String, Plugin<ConfigProvider>>
  • newConfigProvider now returns a plugin-wrapped provider and accepts metrics for instrumentation
  • The plugin map is correctly passed to WorkerConfigTransformer

This aligns with the broader PR effort to adopt plugin-based lifecycle management and enable metrics registration for Monitorable ConfigProvider implementations.

connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerConfigTransformer.java (3)

23-23: LGTM! Import added for Plugin wrapper.

The import supports the plugin-wrapped ConfigProvider pattern.


46-52: LGTM! Constructor and field updated to use Plugin-wrapped providers.

The changes correctly update the class to:

  • Store Map<String, Plugin<ConfigProvider>> instead of raw providers
  • Accept plugin-wrapped providers in the constructor
  • Pass the plugin map to ConfigTransformer

This aligns with the broader PR effort to adopt plugin-based lifecycle management for ConfigProvider instances.


101-101: LGTM! Cleanup updated to close plugin-wrapped providers.

The close method now correctly closes plugin-wrapped providers using Utils.closeQuietly. This ensures both the ConfigProvider instance and any associated plugin metrics are properly cleaned up.

connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/PluginsTest.java (4)

25-28: LGTM! Imports added for monitorable provider testing.

The new imports support testing of the Monitorable interface integration with ConfigProvider plugins.


381-402: LGTM! Test updated to use plugin-based ConfigProvider API.

The test correctly updates to the new API where:

  • newConfigProvider returns Plugin<ConfigProvider> instead of raw ConfigProvider
  • The provider instance is accessed via plugin.get()
  • Null metrics are passed since this test doesn't verify metrics behavior

404-412: LGTM! New test verifies correct initialization order for Monitorable providers.

The test verifies that when a ConfigProvider implements Monitorable and metrics are provided:

  • The provider is properly instantiated
  • The withPluginMetrics method is called after configure() (verified by the assertion in CustomMonitorableConfigProvider)

This ensures the plugin lifecycle is correct for metric-enabled providers.


810-816: LGTM! Test helper verifies initialization order.

The CustomMonitorableConfigProvider test class correctly asserts that configured is true when withPluginMetrics is called, ensuring that configuration happens before metric registration. This validates the correct initialization order in the plugin lifecycle.

connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerConfigTransformerTest.java (3)

69-69: LGTM! Plugin wrapping aligns with the broader refactoring.

The test correctly wraps the TestConfigProvider with Plugin.wrapInstance, passing null for metrics which is appropriate for this unit test context. The extra tags map correctly identifies the provider as "test".


75-75: LGTM! Cleaner test data construction.

The conversion from Collections.singletonMap(...) to Map.of(...) improves readability and is consistent with modern Java practices.

Also applies to: 100-100, 115-115, 122-122


150-157: LGTM! TestConfigProvider updated consistently.

The test provider's ConfigData creation now uses Map.of(...) instead of Collections methods, maintaining consistency with the rest of the test file changes.

connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerTest.java (3)

379-390: LGTM! Mock provider correctly wrapped with Plugin.

The mockFileConfigProvider method now returns a Plugin<ConfigProvider> instead of a raw ConfigProvider, correctly wrapping the instance with extra tags to identify the file provider. The null metrics argument is appropriate for this mock context.


2904-2927: LGTM! Well-structured test for monitorable config providers.

The test correctly:

  • Configures multiple config providers ("monitorable" and "monitorable2")
  • Mocks the plugins to return Plugin-wrapped MonitorableConfigProvider instances with metrics
  • Verifies that metrics are registered with the expected tags for each provider

The test effectively validates the metrics integration for monitorable config providers.


2929-2950: LGTM! Clean helper methods for metrics assertions.

The expectedTags and assertMetrics helper methods provide clear, reusable logic for:

  • Constructing expected metric tags with config, class, and extra tags
  • Verifying metrics are registered in the "plugins" group with the correct tags, name, and description

The implementation correctly uses LinkedHashMap to maintain tag ordering and provides clear assertion messages.

connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/Plugins.java (2)

632-633: API change: Method now returns Plugin-wrapped ConfigProvider.

The method signature changes from returning ConfigProvider to Plugin<ConfigProvider> and accepts a new Metrics parameter. The parameter also changes from providerPrefix to providerName, with the prefix now derived internally. This is a breaking API change that aligns with the broader refactoring to enable metrics for config providers.

Ensure all callers have been updated to handle the Plugin-wrapped return type. Based on the PR context, this appears to be addressed in Worker.java and WorkerConfigTransformer.java.


649-649: LGTM! ConfigProvider correctly wrapped with metrics support.

The method now returns Plugin.wrapInstance(plugin, metrics, WorkerConfig.CONFIG_PROVIDERS_CONFIG, Map.of("provider", providerName)), which:

  • Wraps the ConfigProvider instance for lifecycle management
  • Passes metrics for monitoring (if the provider implements Monitorable)
  • Tags the provider with "config" → "config.providers" and "provider" → providerName for metric identification

This enables the metrics integration tested in WorkerTest.testMonitorableConfigProvider.

clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java (4)

23-23: LGTM!

The import is necessary for wrapping ConfigProvider instances with Plugin.


550-559: LGTM!

The transition from Map<String, ConfigProvider> to Map<String, Plugin<ConfigProvider>> is handled correctly. The cleanup path properly closes Plugin instances using Utils.closeQuietly, and the ConfigTransformer construction aligns with the plugin-wrapped provider pattern mentioned in the enriched summary.


598-602: LGTM!

The method signature correctly reflects the plugin-wrapped provider pattern. Since this is a private method, there's no public API impact.


629-632: Ignore null‐metrics concern: passing null for the Metrics parameter to Plugin.wrapInstance in AbstractConfig is intentional and consistent with existing usage; AbstractConfig does not maintain a Metrics instance.

Likely an incorrect or invalid review comment.

Comment on lines +65 to 66
* @param configProviderPlugins a Map of provider names and {@link ConfigProvider} instances.
*/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Adjust Javadoc to mention Plugin<ConfigProvider>.

The parameter documentation still refers to raw provider instances, but we now expect plugin-wrapped providers. Please update the wording to avoid confusion.

🤖 Prompt for AI Agents
In clients/src/main/java/org/apache/kafka/common/config/ConfigTransformer.java
around lines 65 to 66, update the Javadoc for the parameter to reflect that the
map contains Plugin<ConfigProvider> values rather than raw ConfigProvider
instances; change the wording to state "a Map of provider names to
Plugin<ConfigProvider> instances" (or similar) and briefly note that each entry
is a plugin-wrapped ConfigProvider to avoid confusion.

Comment on lines +41 to +48
public ConfigData get(String path) {
return null;
}

@Override
public ConfigData get(String path, Set<String> keys) {
return null;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Return valid ConfigData instead of null.

ConfigTransformer dereferences the result of ConfigProvider#get(...). Returning null here will trigger an NPE the moment this provider is exercised. Please return an empty ConfigData (or one populated for the test) so the transformer can proceed safely.

     @Override
     public ConfigData get(String path) {
-        return null;
+        return new ConfigData(Map.of());
     }

     @Override
     public ConfigData get(String path, Set<String> keys) {
-        return null;
+        return new ConfigData(Map.of());
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public ConfigData get(String path) {
return null;
}
@Override
public ConfigData get(String path, Set<String> keys) {
return null;
}
@Override
public ConfigData get(String path) {
return new ConfigData(Map.of());
}
@Override
public ConfigData get(String path, Set<String> keys) {
return new ConfigData(Map.of());
}
🤖 Prompt for AI Agents
In
clients/src/test/java/org/apache/kafka/common/config/provider/MonitorableConfigProvider.java
around lines 41 to 48, the two get(...) methods currently return null causing a
potential NPE in ConfigTransformer; replace these null returns with valid
ConfigData instances (e.g., return new ConfigData(Collections.emptyMap(),
System.currentTimeMillis()) or a ConfigData populated with test values) so the
provider always returns a non-null ConfigData for both get(String) and
get(String, Set<String>) paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants